package mo.leetcode_top;

import java.util.Arrays;

public class L283 {

    public void moveZeroes(int[] nums) {
        for (int i = 0, j = 0; i < nums.length; i++) {
            if (nums[i] != 0) {
                int tmp = nums[i];
                nums[i] = nums[j];
                nums[j] = tmp;
                j++;
            }
        }
    }

    public static void main(String[] args) {
        L283 test = new L283();
        int[] arr = new int[]{0,1,2,3,12};
        test.moveZeroes(arr);
        System.out.println(Arrays.toString(arr));
    }

}
